<template>
  <div class="appnav">
    <div class="appmain">
      <div class="logo">
        <a href="/" title="甘某人个人博客"><h1>甘某人个人博客</h1></a>
      </div>
      <ul class="apptab">
        <li><router-link to="/">首页</router-link></li>
        <li><router-link to="/article">文章</router-link></li>
        <li><router-link to="/message">留言</router-link></li>
        <li><router-link to="/link">友链</router-link></li>
        <li><router-link to="/about">关于</router-link></li>
      </ul>
      <!-- <i class="menu el-icon-s-unfold"></i> -->
      <div class="login">
        <login-user v-if="userInfo.username" />
        <login-dialog v-else />
      </div>
    </div>
  </div>
</template>

<script>
import LoginDialog from "./LoginRegister/LoginDialog.vue";
import LoginUser from "./LoginRegister/LoginUser.vue";
import { mapState } from "vuex";
export default {
  name: "AppNav",
  components: {
    LoginDialog,
    LoginUser,
  },
  data() {
    return {};
  },
  computed: {
    ...mapState(["userInfo"]),
  },
  methods: {},
};
</script>

<style lang="less" scoped>
.appnav {
  position: fixed;
  z-index: 999;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background-color: #fff;
  box-shadow: 0 0 2px #ccc;
  box-sizing: border-box;
  .appmain {
    display: flex;
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    justify-content: space-between;
  }
  .logo {
    a {
      h1 {
        font-size: 22px;
        line-height: 50px;
        text-shadow: #000 1px 1px 2px;
        color: #0881b3;
      }
    }
  }
  .apptab {
    display: flex;
    li {
      padding: 0 10px;
      a {
        display: block;
        height: 50px;
        line-height: 50px;
        padding: 0 30px;
        font-size: 16px;
        color: #000;
        border-bottom: 3px solid transparent;
        &.router-link-active {
          color: #409eff;
          border-bottom-color: #409eff;
        }
        &:hover {
          color: #409eff;
        }
      }
    }
  }
  .login {
    display: flex;
    align-items: center;
  }
  .dialog {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    width: 500px;
    height: 600px;
    background: #fff;
  }
}
@media screen and (max-width: 1200px) {
  .appnav {
    padding: 0 20px;
  }
}
</style>